/// <reference path="../game/fourkill.util.js" />
/// <reference path="../game/fourkill.sprite.singletons.js" />
/// <reference path="../painters/fourkill.painter.singletons.js" />

var TestDudeObject = GameObject.extend({
    initialize: function initialize(sprite) {
        GameObject.initialize.call(this);

        this.BOUNDRY_SIZE = 1000;
        this.z = 0;
        this.speed = 0;
        this.turnSpeed = util.radians(5);
        this.boundaries = null;
        this.turnCounter = 0;
        this.turnDirection = 1;
        this.moveCounter = 0;
        this.sprite = sprite;
    },
    tick: function tick() {

        if (this.moveCounter > 0) {
            this.move(this.speed);
            this.moveCounter -= this.speed;
        }
        if (this.turnCounter > 0) {
            this.turn(this.turnSpeed * this.turnDirection);
            this.turnCounter -= this.turnSpeed;
        }

        if (this.moveCounter <= 0) {
            var r = util.random(100);
            if (r == 5) {
                this.speed = util.random() * util.random(1, 2) + 1;
                this.moveCounter = util.random() * util.random(10, 300);
                this.turnCounter = util.random() * util.random(45, 180);
                this.turnDirection = util.random(10) < 5 ? 1 : -1;
            }
            else if (r < 5) {
                this.speed = 0;
            }
        }
    },
    getPainter: function getPainter() { return Painters.AdvancedSpritePainter; }
});
